﻿@{
    Layout = "~/Views/Shared/_LayuiLayout.cshtml";
}

<form class="layui-form">
    <input type="hidden" value="@ViewData["IdList"]" name="IdList" />
    <div class="layui-form-item">
        <div class="layui-col-md12">
            <label class="layui-form-label">物流公司</label>
            <div class="layui-input-block">
                <input type="text" name="LogisticsCompany" required lay-verify="required" placeholder="请输入物流公司" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-col-md12">
            <label class="layui-form-label">物流单号</label>
            <div class="layui-input-block">
                <input type="text" name="LogisticsNumber" required lay-verify="required" placeholder="请输入物流单号" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="button" lay-submit lay-filter="Save" id="Save">发货</button>
            <button type="button" class="layui-btn layui-btn-primary" id="btnCancel">取消</button>
        </div>
    </div>
</form>

@section scripts{
    <script type="text/javascript">
        var $, layer;
        var html = "";
        layui.use(['form', 'laydate'], function () {
            var form = layui.form;
            $ = layui.jquery;
            layer = layui.layer;

            // 监听关闭
            $('#btnCancel').on('click', function () {
                layer_close();
            });


            var postUrl = '@Url.Action("DeliverGoodsList", "Order")';

            // 监听提交
            form.on('submit(Save)', function (data) {
                var loading = layer.load();
                $.post(postUrl, { IdList: data.field.IdList, LogisticsCompany: data.field.LogisticsCompany, LogisticsNumber: data.field.LogisticsNumber },
                    function (result) {
                        layer.close(loading);

                        if (result.Success) {
                            layer.msg(result.Message, { icon: 1, time: 3000 });
                            parent.reload();
                            layer_close();

                        } else {
                            layer.alert(result.Message, { icon: 2 });
                        }
                    });
                return false;
            });
        });
    </script>
}

